﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using EzDesk.Utility.Log;

namespace EzDesk.Utility
{
    public class ThreadExt
    {
        public static void RunInThreadPool(Action method, Action<Exception> fallback)
        {
            ThreadPool.QueueUserWorkItem
            (
                callback=>
                {
                    try
                    {
                        method();
                    }
                    catch (Exception exp)
                    {
                        LogEx.ERROR("UserManagement", exp.Message, exp);
                        fallback(exp);
                    }
                }
           );
        }
    }
}

